//*************************************************************************************************
//Copyright (c) 2015.year. @hjjer.
//If you are a hjjer(hejianjiao.org), This code is unlicensed, otherwise,is licensed under the GPL.
//*************************************************************************************************

package com.truthbean.ssm.demo.controller;

import com.truthbean.ssm.demo.domain.model.EnrollModel;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Truthbean
 * @since 2015-12-23 19:21:05
 */
@RestController
@RequestMapping("enroll")
public class ViewController {

    EnrollModel model = new EnrollModel();

    @RequestMapping(value = "/{area}.json", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/json;charset=UTF-8")
    public EnrollModel getEnrollModelInJSON(@PathVariable String area) {
        model.setArea(area);
        model.setYears(new String[]{"2012", "2014"});
        return model;
    }

    @RequestMapping(value = "/{area}.xml", method = RequestMethod.GET, produces = "application/xml;charset=UTF-8")
    public EnrollModel getEnrollModelInXML(@PathVariable String area) {
        model.setArea(area);
        model.setYears(new String[]{"2012", "2014"});
        return model;
    }
}
